package com.gt.web.controller.app;

import com.gt.app.domain.dto.EsMergeDiseaseHistoryDto;
import com.gt.app.service.EsMergeDiseaseHistoryService;
import com.gt.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 合并疾病及手术史表 前端控制器
 * </p>
 *
 * @author caidesheng
 */
@Slf4j
@RestController
@RequestMapping("esMergeDiseaseHistory")
@Api(tags = "合并疾病及手术史接口")
public class EsMergeDiseaseHistoryController {

    @Autowired
    private EsMergeDiseaseHistoryService esMergeDiseaseHistoryService;

    @ApiOperation(value = "新增合并疾病及手术史")
    @PostMapping(value = "add")
    public AjaxResult add(@RequestBody EsMergeDiseaseHistoryDto esMergeDiseaseHistoryDto) {

        esMergeDiseaseHistoryService.add(esMergeDiseaseHistoryDto);
        return AjaxResult.success();
    }

    @ApiOperation(value = "根据checkId获取合并疾病及手术史")
    @GetMapping(value = "getEnvironmentFactorInfo")
    public AjaxResult getMergeDiseaseHistory(String checkId) {
        EsMergeDiseaseHistoryDto esMergeDiseaseHistoryDto = esMergeDiseaseHistoryService.getMergeDiseaseHistory(checkId);
        return AjaxResult.success(esMergeDiseaseHistoryDto);
    }
}
